home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17097 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.NetVision.net.il!news
  2. From: ggil@netvision.net.il
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: Q:Hex to Decimal?
  5. Date: Sat, 13 Apr 96 19:10:18 PDT
  6. Organization: NetVision LTD.
  7. Message-ID: <NEWTNews.829447901.13807.ggil@dialup.netvision.net.il>
  8. References: <316D2289.4759@tricon.net>
  9. NNTP-Posting-Host: ts000p15.pop9a.netvision.net.il
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=US-ASCII
  12. X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
  13.  
  14.  
  15. In Article<316D2289.4759@tricon.net>, <tacooper@tricon.net> writes:
  16. > Path: news.NetVision.net.il!psinntp!psinntp!psinntp!howland.reston.ans.net!newsfeed.internetmci.com!in2.uu.net!news.tricon.net!usenet
  17. > From: Thomas A Cooper <tacooper@tricon.net>
  18. > Newsgroups: comp.lang.c,comp.lang.c++
  19. > Subject: Q:Hex to Decimal?
  20. > Date: Thu, 11 Apr 1996 11:17:29 -0400
  21. > Organization: Tri-Cities Connection
  22. > Lines: 13
  23. > Message-ID: <316D2289.4759@tricon.net>
  24. > NNTP-Posting-Host: pm1-13.tricon.net
  25. > Mime-Version: 1.0
  26. > Content-Type: text/plain; charset=us-ascii
  27. > Content-Transfer-Encoding: 7bit
  28. > X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  29. > Xref: news.NetVision.net.il comp.lang.c:9794 comp.lang.c++:11749
  30. > I saw in a magazine a simple function to convert a HEX string to an 
  31. > integer:
  32. > long int FAR PASCAL hex2int(char far *s)
  33. > {
  34. >      return strtol(s,NULL,16);
  35. > }
  36. >  I'm struggling with the reverse situation, a function to convert an 
  37. > integer into a HEX string. Anybody got any ideas?? Thanks in advance for 
  38. > your help.
  39. >                               Tom Cooper
  40. >                               tacooper@tricon.net
  41.  
  42. just use 
  43.     sprintf(string, "%x", i)
  44.  
  45.  
  46. ggil@netvision.net.il
  47.  
  48.  
  49.